#ifndef PROCESSTHREAD_H
#define PROCESSTHREAD_H
#include <QThread>
#include <QProcess>
#include <QDebug>

#include <QCoreApplication>

class ProcessThread : public QThread
{
public:
    ProcessThread();

    void run() override {
           QProcess* pProcess = new QProcess(qApp);
           QString program = "dxfexplode.exe";
           QStringList arguments;
           arguments << qApp->applicationDirPath() + "/A.dxf" << qApp->applicationDirPath() + "/A1.dxf";

           // 启动进程
           pProcess->start(program, arguments);
           // 等待进程结束
           if (!pProcess->waitForFinished()) {
               qDebug() << "Process failed:" << pProcess->errorString();
               return;
           }

           pProcess->deleteLater();
           *m_pNumber = 0x123;
           m_number = 0x123456;
           printf("*m_pNumber=%d\n", *m_pNumber);
       }

    void SetParameters(int* pNumber, int number)
    {
        m_pNumber = pNumber;
        m_number = number;
    }

private:
    int* m_pNumber;
    int m_number;
};

#endif // PROCESSTHREAD_H
